using System;
using System.Collections;
using System.Xml.Serialization;

namespace VPLink2013.Webparts
{
	/// <summary>
	/// Summary description for taSPList.
	/// </summary>
	[XmlRootAttribute("List", IsNullable = false)]
	public class taSPList
	{
        [XmlAttributeAttribute]
        public string UrlPageDetail = "";
        [XmlAttributeAttribute]
		public string Template = "";
		[XmlAttributeAttribute]
		public string Moderation = "";
		[XmlAttributeAttribute]
		public int PageCrt = 1;
		[XmlAttributeAttribute]
		public int ItemCount = 0;
		[XmlAttributeAttribute]
		public int ItemStart = 0;
		[XmlAttributeAttribute]
		public int ItemEnd = 0;
		[XmlAttributeAttribute]
		public int PageCount = 0;
        [XmlAttributeAttribute]
        public string Name = "";
        [XmlAttributeAttribute]
        public string DisplayMode = "";

		[XmlAttributeAttribute]
		public int PageSize = 10;
		[XmlAttributeAttribute]
        public string Sort = "Title";
		[XmlAttributeAttribute]
		public string SortMode = "ASC";
		[XmlAttributeAttribute]
		public string FilterField = "";
		[XmlAttributeAttribute]
		public string FilterValue = "";
		[XmlAttributeAttribute]
		public string FilterOptions = "";

        public string Javascript;

		public ListFilter Filter;
		
		
		public taAction Action;

		public taSPList()
		{
			Filter = new ListFilter();
		}

		public void AddItem(taSPListItem item)
		{
			mItemList.Add(item);
		}
		
		private ArrayList mItemList = new ArrayList();
		[XmlArrayAttribute("Items")]
		[XmlArrayItemAttribute(ElementName = "Item", 
			 IsNullable = true,
			 Type = typeof(taSPListItem))]
		public ArrayList ItemList
		{
			get	
			{
				return mItemList;
			}
			set 
			{
				mItemList = value;
			}
		}		 
		
		public void AddField(string Name, string Type, string Value, string Width, string Align)
		{
			taSPField field = new taSPField();
			field.Name = Name;
			field.Type = Type;
			field.Value = Value;
			field.Width = Width;
			field.Align = Align;
			mFieldList.Add(field);
		}

		private ArrayList mFieldList = new ArrayList();
		[XmlArrayAttribute("Fields")]
		[XmlArrayItemAttribute(ElementName = "Field", 
			 IsNullable = true,
			 Type = typeof(taSPField))]
		public ArrayList FieldList
		{
			get	
			{
				return mFieldList;
			}
			set 
			{
				mFieldList = value;
			}
		}		 

		public string UrlZone;
		public string ViewName;

		public void AddView(string Name, string Url)
		{
			taSPListView view = new taSPListView();
			view.Name = Name;
			view.Url = Url;
			mListViewList.Add(view);
		}


		private ArrayList mListViewList = new ArrayList();
		[XmlArrayAttribute("ListViews")]
		[XmlArrayItemAttribute(ElementName = "ListView", 
			 IsNullable = true,
			 Type = typeof(taSPListView))]
		public ArrayList ListViewList
		{
			get	
			{
				return mListViewList;
			}
			set 
			{
				mListViewList = value;
			}
		}
	}
}
